<template>

<el-dialog
  title="试题审核"
  :visible.sync="dialogVisible"
  width="30%"
  :before-close="handleClose">
  <el-form ref="form" :model="form" label-width="80px" :rules="rules">
    <el-radio-group v-model="form.chkState">
      <el-radio label="通过" ></el-radio>
      <el-radio label="拒绝"></el-radio>
    </el-radio-group>
     <el-form-item  prop="chkRemarks">
    <el-input type="textarea" v-model="form.chkRemarks" placeholder="请输入审核意见" ></el-input>
      </el-form-item>
    <el-button @click="dialogVisible = false">取 消</el-button>
    <el-button type="primary" @click="submit">确 定</el-button>
  </el-form>
</el-dialog>
</template>

<script>
import { choiceCheck } from '@/api/hmmm/questions.js'
export default {
  props: ['form'],
  data () {
    return {
      dialogVisible: false,
      rules: {
        chkRemarks: [{ required: true, message: '请输入意见', trigger: 'blur' }]
      }
    }
  },
  methods: {
    handleClose () {
      this.$refs.form.resetFields()
      this.dialogVisible = false
    },
    async submit () {
      try {
        this.$refs.form.validate()
        this.form.chkState = this.form.chkState === '通过' ? 1 : 2
        await choiceCheck(this.form)
        this.$emit('newDataes')
        this.$message.success('修改成功')
        this.handleClose()
      } catch (error) {
        this.$message.error('请填写必填项')
      }
    }
  }
}
</script>

<style scoped lang='less'></style>
